{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Stage 1 True Result Extractor\n",
    "This notebook will extract the correct answer for stage 1 of the Kaggle competition from stage 2 data `train_2.csv`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np # linear algebra\n",
    "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
    "import matplotlib.pyplot as plt\n",
    "import gc  # Python garbage collect"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "input_file = 'train_2.csv'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%%% Reading train_2.csv ... done!\n"
     ]
    }
   ],
   "source": [
    "print('%%% Reading', input_file, '... ', end = '', flush = True)\n",
    "input_df = pd.read_csv('../data/' + input_file)\n",
    "print('done!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 145063 entries, 0 to 145062\n",
      "Columns: 794 entries, Page to 2017-08-31\n",
      "dtypes: float64(793), object(1)\n",
      "memory usage: 878.8+ MB\n"
     ]
    }
   ],
   "source": [
    "input_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>2015-07-01</th>\n",
       "      <th>2015-07-02</th>\n",
       "      <th>2015-07-03</th>\n",
       "      <th>2015-07-04</th>\n",
       "      <th>2015-07-05</th>\n",
       "      <th>2015-07-06</th>\n",
       "      <th>2015-07-07</th>\n",
       "      <th>2015-07-08</th>\n",
       "      <th>2015-07-09</th>\n",
       "      <th>...</th>\n",
       "      <th>2017-08-22</th>\n",
       "      <th>2017-08-23</th>\n",
       "      <th>2017-08-24</th>\n",
       "      <th>2017-08-25</th>\n",
       "      <th>2017-08-26</th>\n",
       "      <th>2017-08-27</th>\n",
       "      <th>2017-08-28</th>\n",
       "      <th>2017-08-29</th>\n",
       "      <th>2017-08-30</th>\n",
       "      <th>2017-08-31</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2NE1_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>18.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>...</td>\n",
       "      <td>37.0</td>\n",
       "      <td>58.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>44.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>21.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2PM_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>11.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>...</td>\n",
       "      <td>14.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>25.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3C_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>...</td>\n",
       "      <td>6.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4minute_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>35.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>94.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>...</td>\n",
       "      <td>21.0</td>\n",
       "      <td>42.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>110.0</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>23.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>5566_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>12.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>...</td>\n",
       "      <td>32.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>91Days_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>68.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>A'N'D_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>118.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>127.0</td>\n",
       "      <td>53.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>...</td>\n",
       "      <td>175.0</td>\n",
       "      <td>84.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>105.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>72.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>86.0</td>\n",
       "      <td>52.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>AKB48_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>5.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>...</td>\n",
       "      <td>35.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>68.0</td>\n",
       "      <td>40.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>ASCII_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>...</td>\n",
       "      <td>32.0</td>\n",
       "      <td>53.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>28.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>ASTRO_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>15.0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>Ahq_e-Sports_Club_zh.wikipedia.org_all-access_...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>...</td>\n",
       "      <td>15.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>11.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>All_your_base_are_belong_to_us_zh.wikipedia.or...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>AlphaGo_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>20.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>26.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>Android_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>8.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>...</td>\n",
       "      <td>92.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>69.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>52.0</td>\n",
       "      <td>63.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>Angelababy_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>40.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>42.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>...</td>\n",
       "      <td>40.0</td>\n",
       "      <td>75.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>17.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>Apink_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>61.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>195.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>...</td>\n",
       "      <td>79.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>55.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>Apple_II_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>4.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>...</td>\n",
       "      <td>28.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>As_One_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>13.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>...</td>\n",
       "      <td>14.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>37.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>B-PROJECT_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>10.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>B1A4_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>22.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>74.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>...</td>\n",
       "      <td>12.0</td>\n",
       "      <td>72.0</td>\n",
       "      <td>56.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>173.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>26.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>BDSM_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>25.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>...</td>\n",
       "      <td>19.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>BEAST_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>19.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>...</td>\n",
       "      <td>7.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>BIGBANG_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>23.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>50.0</td>\n",
       "      <td>...</td>\n",
       "      <td>36.0</td>\n",
       "      <td>68.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>BLACK_PINK_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>17.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>25.0</td>\n",
       "      <td>23.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>BLEACH_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>11.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>...</td>\n",
       "      <td>20.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>87.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>19.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>BTOB_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>22.0</td>\n",
       "      <td>67.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>...</td>\n",
       "      <td>22.0</td>\n",
       "      <td>40.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>59.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>46.0</td>\n",
       "      <td>21.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>Beautiful_Mind_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>11.0</td>\n",
       "      <td>30.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>Beyond_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>291.0</td>\n",
       "      <td>64.0</td>\n",
       "      <td>26.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>48.0</td>\n",
       "      <td>...</td>\n",
       "      <td>41.0</td>\n",
       "      <td>49.0</td>\n",
       "      <td>94.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>38.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>20.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>Big_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>3.0</td>\n",
       "      <td>53.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>...</td>\n",
       "      <td>11.0</td>\n",
       "      <td>28.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145033</th>\n",
       "      <td>Sin_senos_sí_hay_paraíso_es.wikipedia.org_all-...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>24.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145034</th>\n",
       "      <td>Anexo:Medallero_de_los_Juegos_Olímpicos_de_Río...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145035</th>\n",
       "      <td>Arrival_(película)_es.wikipedia.org_all-access...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145036</th>\n",
       "      <td>Anexo:Baloncesto_en_los_Juegos_Olímpicos_de_Rí...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145037</th>\n",
       "      <td>Hasta_que_te_conocí_(serie_de_televisión)_es.w...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145038</th>\n",
       "      <td>Westworld_(serie_de_televisión)_es.wikipedia.o...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145039</th>\n",
       "      <td>Milénico_es.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145040</th>\n",
       "      <td>Moonlight_(película)_es.wikipedia.org_all-acce...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>6.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145041</th>\n",
       "      <td>Sully_(película)_es.wikipedia.org_all-access_s...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145042</th>\n",
       "      <td>Pulsaciones_(serie_de_televisión)_es.wikipedia...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145043</th>\n",
       "      <td>2091_(serie_de_televisión)_es.wikipedia.org_al...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145044</th>\n",
       "      <td>Campeonato_Sudamericano_de_Fútbol_Sub-20_de_20...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>6.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145045</th>\n",
       "      <td>Split_(película)_es.wikipedia.org_all-access_s...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145046</th>\n",
       "      <td>Huracán_Matthew_es.wikipedia.org_all-access_sp...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>27.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145047</th>\n",
       "      <td>Fences_(película)_es.wikipedia.org_all-access_...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>3.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145048</th>\n",
       "      <td>Logan_(película)_es.wikipedia.org_all-access_s...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145049</th>\n",
       "      <td>La_doña_(telenovela_de_2016)_es.wikipedia.org_...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>11.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145050</th>\n",
       "      <td>RTS_(canal_de_televisión)_es.wikipedia.org_all...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145051</th>\n",
       "      <td>La_ley_del_corazón_es.wikipedia.org_all-access...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145052</th>\n",
       "      <td>The_Crown_(serie_de_televisión)_es.wikipedia.o...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145053</th>\n",
       "      <td>Drake_(músico)_es.wikipedia.org_all-access_spider</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>62.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145054</th>\n",
       "      <td>Skam_(serie_de_televisión)_es.wikipedia.org_al...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>3.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145055</th>\n",
       "      <td>Legión_(serie_de_televisión)_es.wikipedia.org_...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145056</th>\n",
       "      <td>Doble_tentación_es.wikipedia.org_all-access_sp...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>21.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145057</th>\n",
       "      <td>Mi_adorable_maldición_es.wikipedia.org_all-acc...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>5.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145058</th>\n",
       "      <td>Underworld_(serie_de_películas)_es.wikipedia.o...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>2.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>7.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145059</th>\n",
       "      <td>Resident_Evil:_Capítulo_Final_es.wikipedia.org...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145060</th>\n",
       "      <td>Enamorándome_de_Ramón_es.wikipedia.org_all-acc...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>9.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145061</th>\n",
       "      <td>Hasta_el_último_hombre_es.wikipedia.org_all-ac...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>145062</th>\n",
       "      <td>Francisco_el_matemático_(serie_de_televisión_d...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>1.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>145063 rows × 794 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                     Page  2015-07-01  \\\n",
       "0                 2NE1_zh.wikipedia.org_all-access_spider        18.0   \n",
       "1                  2PM_zh.wikipedia.org_all-access_spider        11.0   \n",
       "2                   3C_zh.wikipedia.org_all-access_spider         1.0   \n",
       "3              4minute_zh.wikipedia.org_all-access_spider        35.0   \n",
       "4       52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...         NaN   \n",
       "5                 5566_zh.wikipedia.org_all-access_spider        12.0   \n",
       "6               91Days_zh.wikipedia.org_all-access_spider         NaN   \n",
       "7                A'N'D_zh.wikipedia.org_all-access_spider       118.0   \n",
       "8                AKB48_zh.wikipedia.org_all-access_spider         5.0   \n",
       "9                ASCII_zh.wikipedia.org_all-access_spider         6.0   \n",
       "10               ASTRO_zh.wikipedia.org_all-access_spider         NaN   \n",
       "11      Ahq_e-Sports_Club_zh.wikipedia.org_all-access_...         2.0   \n",
       "12      All_your_base_are_belong_to_us_zh.wikipedia.or...         2.0   \n",
       "13             AlphaGo_zh.wikipedia.org_all-access_spider         NaN   \n",
       "14             Android_zh.wikipedia.org_all-access_spider         8.0   \n",
       "15          Angelababy_zh.wikipedia.org_all-access_spider        40.0   \n",
       "16               Apink_zh.wikipedia.org_all-access_spider        61.0   \n",
       "17            Apple_II_zh.wikipedia.org_all-access_spider         4.0   \n",
       "18              As_One_zh.wikipedia.org_all-access_spider        13.0   \n",
       "19           B-PROJECT_zh.wikipedia.org_all-access_spider         NaN   \n",
       "20                B1A4_zh.wikipedia.org_all-access_spider        22.0   \n",
       "21                BDSM_zh.wikipedia.org_all-access_spider        25.0   \n",
       "22               BEAST_zh.wikipedia.org_all-access_spider        19.0   \n",
       "23             BIGBANG_zh.wikipedia.org_all-access_spider        23.0   \n",
       "24          BLACK_PINK_zh.wikipedia.org_all-access_spider         NaN   \n",
       "25              BLEACH_zh.wikipedia.org_all-access_spider        11.0   \n",
       "26                BTOB_zh.wikipedia.org_all-access_spider        22.0   \n",
       "27      Beautiful_Mind_zh.wikipedia.org_all-access_spider         NaN   \n",
       "28              Beyond_zh.wikipedia.org_all-access_spider       291.0   \n",
       "29                 Big_zh.wikipedia.org_all-access_spider         3.0   \n",
       "...                                                   ...         ...   \n",
       "145033  Sin_senos_sí_hay_paraíso_es.wikipedia.org_all-...         NaN   \n",
       "145034  Anexo:Medallero_de_los_Juegos_Olímpicos_de_Río...         NaN   \n",
       "145035  Arrival_(película)_es.wikipedia.org_all-access...         NaN   \n",
       "145036  Anexo:Baloncesto_en_los_Juegos_Olímpicos_de_Rí...         NaN   \n",
       "145037  Hasta_que_te_conocí_(serie_de_televisión)_es.w...         NaN   \n",
       "145038  Westworld_(serie_de_televisión)_es.wikipedia.o...         NaN   \n",
       "145039        Milénico_es.wikipedia.org_all-access_spider         NaN   \n",
       "145040  Moonlight_(película)_es.wikipedia.org_all-acce...         NaN   \n",
       "145041  Sully_(película)_es.wikipedia.org_all-access_s...         NaN   \n",
       "145042  Pulsaciones_(serie_de_televisión)_es.wikipedia...         NaN   \n",
       "145043  2091_(serie_de_televisión)_es.wikipedia.org_al...         NaN   \n",
       "145044  Campeonato_Sudamericano_de_Fútbol_Sub-20_de_20...         NaN   \n",
       "145045  Split_(película)_es.wikipedia.org_all-access_s...         NaN   \n",
       "145046  Huracán_Matthew_es.wikipedia.org_all-access_sp...         NaN   \n",
       "145047  Fences_(película)_es.wikipedia.org_all-access_...         NaN   \n",
       "145048  Logan_(película)_es.wikipedia.org_all-access_s...         NaN   \n",
       "145049  La_doña_(telenovela_de_2016)_es.wikipedia.org_...         NaN   \n",
       "145050  RTS_(canal_de_televisión)_es.wikipedia.org_all...         NaN   \n",
       "145051  La_ley_del_corazón_es.wikipedia.org_all-access...         NaN   \n",
       "145052  The_Crown_(serie_de_televisión)_es.wikipedia.o...         NaN   \n",
       "145053  Drake_(músico)_es.wikipedia.org_all-access_spider         NaN   \n",
       "145054  Skam_(serie_de_televisión)_es.wikipedia.org_al...         NaN   \n",
       "145055  Legión_(serie_de_televisión)_es.wikipedia.org_...         NaN   \n",
       "145056  Doble_tentación_es.wikipedia.org_all-access_sp...         NaN   \n",
       "145057  Mi_adorable_maldición_es.wikipedia.org_all-acc...         NaN   \n",
       "145058  Underworld_(serie_de_películas)_es.wikipedia.o...         NaN   \n",
       "145059  Resident_Evil:_Capítulo_Final_es.wikipedia.org...         NaN   \n",
       "145060  Enamorándome_de_Ramón_es.wikipedia.org_all-acc...         NaN   \n",
       "145061  Hasta_el_último_hombre_es.wikipedia.org_all-ac...         NaN   \n",
       "145062  Francisco_el_matemático_(serie_de_televisión_d...         NaN   \n",
       "\n",
       "        2015-07-02  2015-07-03  2015-07-04  2015-07-05  2015-07-06  \\\n",
       "0             11.0         5.0        13.0        14.0         9.0   \n",
       "1             14.0        15.0        18.0        11.0        13.0   \n",
       "2              0.0         1.0         1.0         0.0         4.0   \n",
       "3             13.0        10.0        94.0         4.0        26.0   \n",
       "4              NaN         NaN         NaN         NaN         NaN   \n",
       "5              7.0         4.0         5.0        20.0         8.0   \n",
       "6              NaN         NaN         NaN         NaN         NaN   \n",
       "7             26.0        30.0        24.0        29.0       127.0   \n",
       "8             23.0        14.0        12.0         9.0         9.0   \n",
       "9              3.0         5.0        12.0         6.0         5.0   \n",
       "10             NaN         NaN         NaN         NaN         1.0   \n",
       "11             1.0         4.0         4.0         2.0         6.0   \n",
       "12             5.0         5.0         1.0         3.0         3.0   \n",
       "13             NaN         NaN         NaN         NaN         NaN   \n",
       "14            27.0         9.0        25.0        25.0        10.0   \n",
       "15            17.0        25.0        42.0        41.0         7.0   \n",
       "16            33.0        21.0        10.0        26.0        11.0   \n",
       "17             8.0         4.0         9.0         7.0         4.0   \n",
       "18             7.0        14.0        11.0        20.0         5.0   \n",
       "19             NaN         NaN         NaN         NaN         NaN   \n",
       "20            11.0        23.0        10.0         6.0        12.0   \n",
       "21             3.0         3.0         4.0        12.0        14.0   \n",
       "22             6.0        12.0        14.0        13.0         7.0   \n",
       "23            24.0        31.0         9.0        21.0        27.0   \n",
       "24             NaN         NaN         NaN         NaN         NaN   \n",
       "25             5.0        13.0         8.0         6.0         5.0   \n",
       "26            67.0        26.0        34.0        38.0        13.0   \n",
       "27             NaN         NaN         NaN         NaN         NaN   \n",
       "28            64.0        26.0        20.0        28.0         6.0   \n",
       "29            53.0        11.0         3.0         4.0         3.0   \n",
       "...            ...         ...         ...         ...         ...   \n",
       "145033         NaN         NaN         NaN         NaN         NaN   \n",
       "145034         NaN         NaN         NaN         NaN         NaN   \n",
       "145035         NaN         NaN         NaN         NaN         NaN   \n",
       "145036         NaN         NaN         NaN         NaN         NaN   \n",
       "145037         NaN         NaN         NaN         NaN         NaN   \n",
       "145038         NaN         NaN         NaN         NaN         NaN   \n",
       "145039         NaN         NaN         NaN         NaN         NaN   \n",
       "145040         NaN         NaN         NaN         NaN         NaN   \n",
       "145041         NaN         NaN         NaN         NaN         NaN   \n",
       "145042         NaN         NaN         NaN         NaN         NaN   \n",
       "145043         NaN         NaN         NaN         NaN         NaN   \n",
       "145044         NaN         NaN         NaN         NaN         NaN   \n",
       "145045         NaN         NaN         NaN         NaN         NaN   \n",
       "145046         NaN         NaN         NaN         NaN         NaN   \n",
       "145047         NaN         NaN         NaN         NaN         NaN   \n",
       "145048         NaN         NaN         NaN         NaN         NaN   \n",
       "145049         NaN         NaN         NaN         NaN         NaN   \n",
       "145050         NaN         NaN         NaN         NaN         NaN   \n",
       "145051         NaN         NaN         NaN         NaN         NaN   \n",
       "145052         NaN         NaN         NaN         NaN         NaN   \n",
       "145053         NaN         NaN         NaN         NaN         NaN   \n",
       "145054         NaN         NaN         NaN         NaN         NaN   \n",
       "145055         NaN         NaN         NaN         NaN         NaN   \n",
       "145056         NaN         NaN         NaN         NaN         NaN   \n",
       "145057         NaN         NaN         NaN         NaN         NaN   \n",
       "145058         NaN         NaN         NaN         NaN         NaN   \n",
       "145059         NaN         NaN         NaN         NaN         NaN   \n",
       "145060         NaN         NaN         NaN         NaN         NaN   \n",
       "145061         NaN         NaN         NaN         NaN         NaN   \n",
       "145062         NaN         NaN         NaN         NaN         NaN   \n",
       "\n",
       "        2015-07-07  2015-07-08  2015-07-09     ...      2017-08-22  \\\n",
       "0              9.0        22.0        26.0     ...            37.0   \n",
       "1             22.0        11.0        10.0     ...            14.0   \n",
       "2              0.0         3.0         4.0     ...             6.0   \n",
       "3             14.0         9.0        11.0     ...            21.0   \n",
       "4              NaN         NaN         NaN     ...            23.0   \n",
       "5              5.0        17.0        24.0     ...            32.0   \n",
       "6              NaN         NaN         NaN     ...             9.0   \n",
       "7             53.0        37.0        20.0     ...           175.0   \n",
       "8             35.0        15.0        14.0     ...            35.0   \n",
       "9              4.0        13.0         9.0     ...            32.0   \n",
       "10             1.0         NaN         NaN     ...            15.0   \n",
       "11             3.0         6.0         9.0     ...            15.0   \n",
       "12             5.0         3.0        17.0     ...             8.0   \n",
       "13             NaN         NaN         NaN     ...            20.0   \n",
       "14            34.0        22.0        17.0     ...            92.0   \n",
       "15            18.0        21.0        33.0     ...            40.0   \n",
       "16            39.0       195.0        62.0     ...            79.0   \n",
       "17            15.0         9.0        17.0     ...            28.0   \n",
       "18            32.0        11.0         6.0     ...            14.0   \n",
       "19             NaN         NaN         NaN     ...            10.0   \n",
       "20            74.0        17.0        38.0     ...            12.0   \n",
       "21            16.0        15.0        22.0     ...            19.0   \n",
       "22            12.0        64.0         9.0     ...             7.0   \n",
       "23            15.0         8.0        50.0     ...            36.0   \n",
       "24             NaN         NaN         NaN     ...            17.0   \n",
       "25             8.0         5.0        12.0     ...            20.0   \n",
       "26            17.0        33.0        43.0     ...            22.0   \n",
       "27             NaN         NaN         NaN     ...            11.0   \n",
       "28            20.0        10.0        48.0     ...            41.0   \n",
       "29            11.0         9.0         5.0     ...            11.0   \n",
       "...            ...         ...         ...     ...             ...   \n",
       "145033         NaN         NaN         NaN     ...             8.0   \n",
       "145034         NaN         NaN         NaN     ...             2.0   \n",
       "145035         NaN         NaN         NaN     ...             0.0   \n",
       "145036         NaN         NaN         NaN     ...             2.0   \n",
       "145037         NaN         NaN         NaN     ...             0.0   \n",
       "145038         NaN         NaN         NaN     ...             8.0   \n",
       "145039         NaN         NaN         NaN     ...             4.0   \n",
       "145040         NaN         NaN         NaN     ...             6.0   \n",
       "145041         NaN         NaN         NaN     ...             4.0   \n",
       "145042         NaN         NaN         NaN     ...             2.0   \n",
       "145043         NaN         NaN         NaN     ...             0.0   \n",
       "145044         NaN         NaN         NaN     ...             5.0   \n",
       "145045         NaN         NaN         NaN     ...             2.0   \n",
       "145046         NaN         NaN         NaN     ...             1.0   \n",
       "145047         NaN         NaN         NaN     ...             3.0   \n",
       "145048         NaN         NaN         NaN     ...             8.0   \n",
       "145049         NaN         NaN         NaN     ...             7.0   \n",
       "145050         NaN         NaN         NaN     ...             2.0   \n",
       "145051         NaN         NaN         NaN     ...             8.0   \n",
       "145052         NaN         NaN         NaN     ...             2.0   \n",
       "145053         NaN         NaN         NaN     ...             1.0   \n",
       "145054         NaN         NaN         NaN     ...             3.0   \n",
       "145055         NaN         NaN         NaN     ...             1.0   \n",
       "145056         NaN         NaN         NaN     ...             4.0   \n",
       "145057         NaN         NaN         NaN     ...             5.0   \n",
       "145058         NaN         NaN         NaN     ...             2.0   \n",
       "145059         NaN         NaN         NaN     ...             9.0   \n",
       "145060         NaN         NaN         NaN     ...             9.0   \n",
       "145061         NaN         NaN         NaN     ...             1.0   \n",
       "145062         NaN         NaN         NaN     ...             1.0   \n",
       "\n",
       "        2017-08-23  2017-08-24  2017-08-25  2017-08-26  2017-08-27  \\\n",
       "0             58.0        25.0        23.0        25.0        47.0   \n",
       "1             34.0        16.0        31.0        34.0        33.0   \n",
       "2             23.0        11.0         8.0         6.0        13.0   \n",
       "3             42.0        23.0        17.0        11.0        21.0   \n",
       "4             41.0        25.0        22.0        20.0        24.0   \n",
       "5             46.0        31.0        29.0        31.0        28.0   \n",
       "6             68.0         8.0        40.0         6.0        14.0   \n",
       "7             84.0        32.0        37.0       105.0        52.0   \n",
       "8             60.0        36.0        32.0        30.0        41.0   \n",
       "9             53.0        36.0        28.0        15.0        25.0   \n",
       "10            38.0        23.0        51.0        20.0        36.0   \n",
       "11            34.0        16.0        20.0        11.0        22.0   \n",
       "12            23.0        10.0         7.0         5.0         9.0   \n",
       "13            41.0        26.0        17.0        21.0        28.0   \n",
       "14            69.0        36.0        69.0        56.0        52.0   \n",
       "15            75.0        31.0        36.0        32.0        40.0   \n",
       "16            46.0        36.0        47.0        26.0        24.0   \n",
       "17            29.0        12.0        12.0         5.0        11.0   \n",
       "18            30.0        20.0        13.0        34.0        37.0   \n",
       "19            25.0        13.0        14.0        12.0        12.0   \n",
       "20            72.0        56.0        31.0        15.0        32.0   \n",
       "21            40.0        26.0        22.0        22.0        22.0   \n",
       "22            29.0        16.0        19.0         6.0        17.0   \n",
       "23            68.0        54.0        45.0        62.0        62.0   \n",
       "24            45.0        30.0        26.0        18.0        25.0   \n",
       "25            31.0        19.0        87.0        14.0        21.0   \n",
       "26            40.0        64.0        24.0        26.0        59.0   \n",
       "27            30.0        14.0        15.0        12.0        17.0   \n",
       "28            49.0        94.0        32.0        32.0        34.0   \n",
       "29            28.0        16.0        20.0        14.0        20.0   \n",
       "...            ...         ...         ...         ...         ...   \n",
       "145033        18.0        79.0        12.0        21.0        10.0   \n",
       "145034        11.0         6.0         9.0         2.0         8.0   \n",
       "145035        11.0         4.0         7.0         0.0         5.0   \n",
       "145036         7.0         4.0         6.0         0.0         6.0   \n",
       "145037        10.0         5.0         6.0         3.0        23.0   \n",
       "145038        10.0        10.0         7.0         6.0        12.0   \n",
       "145039        10.0         4.0        13.0         1.0         7.0   \n",
       "145040        10.0         8.0         7.0         5.0         7.0   \n",
       "145041         7.0         8.0         8.0         4.0        11.0   \n",
       "145042         6.0         6.0         7.0         9.0         8.0   \n",
       "145043         4.0         3.0         7.0         9.0         8.0   \n",
       "145044         7.0         7.0         6.0         3.0        13.0   \n",
       "145045        13.0         5.0         9.0         2.0        10.0   \n",
       "145046         7.0         7.0        11.0         6.0         6.0   \n",
       "145047         9.0         8.0         6.0         2.0         6.0   \n",
       "145048        13.0        23.0        19.0         9.0        12.0   \n",
       "145049         8.0         9.0        22.0        13.0         7.0   \n",
       "145050         3.0         1.0         4.0         2.0         4.0   \n",
       "145051        16.0         6.0        12.0        11.0         8.0   \n",
       "145052         8.0         6.0        10.0         3.0        10.0   \n",
       "145053         4.0        62.0         6.0         5.0         5.0   \n",
       "145054        13.0        19.0         9.0         7.0         8.0   \n",
       "145055         8.0         7.0         5.0         2.0         8.0   \n",
       "145056        10.0        14.0        23.0         9.0        19.0   \n",
       "145057         8.0        10.0        10.0        10.0         7.0   \n",
       "145058         7.0         6.0         8.0         5.0         7.0   \n",
       "145059        10.0         8.0         6.0         3.0         9.0   \n",
       "145060        16.0        10.0        12.0        10.0        13.0   \n",
       "145061        10.0        10.0        11.0         3.0        10.0   \n",
       "145062         9.0         5.0         8.0         5.0         8.0   \n",
       "\n",
       "        2017-08-28  2017-08-29  2017-08-30  2017-08-31  \n",
       "0             44.0        26.0        24.0        21.0  \n",
       "1             32.0        29.0        34.0        25.0  \n",
       "2             12.0         8.0        12.0         9.0  \n",
       "3             20.0        20.0       110.0        15.0  \n",
       "4             29.0        20.0        17.0        24.0  \n",
       "5             17.0        16.0         8.0        13.0  \n",
       "6             11.0         6.0         9.0         7.0  \n",
       "7             72.0        25.0        86.0        52.0  \n",
       "8             31.0        29.0        68.0        40.0  \n",
       "9             30.0        25.0        36.0        28.0  \n",
       "10            25.0        11.0        12.0        19.0  \n",
       "11            20.0        17.0        18.0        11.0  \n",
       "12             8.0         6.0         2.0        14.0  \n",
       "13            20.0        17.0        18.0        26.0  \n",
       "14            63.0        34.0        46.0        92.0  \n",
       "15            49.0        36.0        22.0        17.0  \n",
       "16            55.0        27.0        36.0        24.0  \n",
       "17            14.0        13.0        10.0        15.0  \n",
       "18            24.0        14.0        15.0        14.0  \n",
       "19            17.0        12.0        16.0        15.0  \n",
       "20            46.0       173.0        27.0        26.0  \n",
       "21            23.0        18.0        22.0        24.0  \n",
       "22            11.0        15.0         8.0        15.0  \n",
       "23            51.0        41.0        39.0        50.0  \n",
       "24            28.0        21.0        25.0        23.0  \n",
       "25            22.0        15.0        17.0        19.0  \n",
       "26            32.0        27.0        46.0        21.0  \n",
       "27            11.0        14.0         7.0        12.0  \n",
       "28            38.0        24.0        18.0        20.0  \n",
       "29            22.0        23.0         9.0        13.0  \n",
       "...            ...         ...         ...         ...  \n",
       "145033        17.0        15.0        27.0        24.0  \n",
       "145034         5.0         7.0         3.0         3.0  \n",
       "145035         1.0         3.0         3.0         1.0  \n",
       "145036         1.0         3.0         2.0         0.0  \n",
       "145037         9.0         3.0         3.0         2.0  \n",
       "145038        11.0         6.0         9.0         2.0  \n",
       "145039         1.0         8.0         3.0         1.0  \n",
       "145040         3.0         6.0         7.0         4.0  \n",
       "145041         4.0         8.0         2.0         4.0  \n",
       "145042         6.0         6.0         5.0         7.0  \n",
       "145043         2.0         5.0         3.0         3.0  \n",
       "145044         1.0         7.0         5.0         6.0  \n",
       "145045         7.0         8.0         6.0         5.0  \n",
       "145046         3.0        27.0         5.0         5.0  \n",
       "145047         3.0         4.0        10.0         3.0  \n",
       "145048        10.0        18.0         9.0         5.0  \n",
       "145049         8.0        11.0         9.0        11.0  \n",
       "145050         0.0         6.0         4.0         0.0  \n",
       "145051         7.0         6.0         8.0         4.0  \n",
       "145052         5.0         7.0         5.0         2.0  \n",
       "145053         4.0         6.0         5.0         1.0  \n",
       "145054        11.0        10.0        10.0        13.0  \n",
       "145055         1.0         5.0         6.0         3.0  \n",
       "145056         4.0        12.0        19.0        21.0  \n",
       "145057         7.0        10.0         6.0        10.0  \n",
       "145058         7.0         7.0         8.0         2.0  \n",
       "145059         2.0        11.0         3.0         3.0  \n",
       "145060        10.0        21.0        11.0         9.0  \n",
       "145061         5.0         3.0         9.0         2.0  \n",
       "145062        11.0         9.0         6.0         5.0  \n",
       "\n",
       "[145063 rows x 794 columns]"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['2015-07-01', '2015-07-02', '2015-07-03', '2015-07-04', '2015-07-05',\n",
       "       '2015-07-06', '2015-07-07', '2015-07-08', '2015-07-09', '2015-07-10',\n",
       "       ...\n",
       "       '2017-08-22', '2017-08-23', '2017-08-24', '2017-08-25', '2017-08-26',\n",
       "       '2017-08-27', '2017-08-28', '2017-08-29', '2017-08-30', '2017-08-31'],\n",
       "      dtype='object', length=793)"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input_df_dates = input_df.columns[1:]; input_df_dates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "Y_output_first_day = '2017-01-01'  # Stage 1 dates\n",
    "Y_output_dates = list(np.arange(np.datetime64(Y_output_first_day), \n",
    "                                    np.datetime64(Y_output_first_day)\n",
    "                                    + np.timedelta64(60, 'D')).astype('str'))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['2017-01-01',\n",
       " '2017-01-02',\n",
       " '2017-01-03',\n",
       " '2017-01-04',\n",
       " '2017-01-05',\n",
       " '2017-01-06',\n",
       " '2017-01-07',\n",
       " '2017-01-08',\n",
       " '2017-01-09',\n",
       " '2017-01-10',\n",
       " '2017-01-11',\n",
       " '2017-01-12',\n",
       " '2017-01-13',\n",
       " '2017-01-14',\n",
       " '2017-01-15',\n",
       " '2017-01-16',\n",
       " '2017-01-17',\n",
       " '2017-01-18',\n",
       " '2017-01-19',\n",
       " '2017-01-20',\n",
       " '2017-01-21',\n",
       " '2017-01-22',\n",
       " '2017-01-23',\n",
       " '2017-01-24',\n",
       " '2017-01-25',\n",
       " '2017-01-26',\n",
       " '2017-01-27',\n",
       " '2017-01-28',\n",
       " '2017-01-29',\n",
       " '2017-01-30',\n",
       " '2017-01-31',\n",
       " '2017-02-01',\n",
       " '2017-02-02',\n",
       " '2017-02-03',\n",
       " '2017-02-04',\n",
       " '2017-02-05',\n",
       " '2017-02-06',\n",
       " '2017-02-07',\n",
       " '2017-02-08',\n",
       " '2017-02-09',\n",
       " '2017-02-10',\n",
       " '2017-02-11',\n",
       " '2017-02-12',\n",
       " '2017-02-13',\n",
       " '2017-02-14',\n",
       " '2017-02-15',\n",
       " '2017-02-16',\n",
       " '2017-02-17',\n",
       " '2017-02-18',\n",
       " '2017-02-19',\n",
       " '2017-02-20',\n",
       " '2017-02-21',\n",
       " '2017-02-22',\n",
       " '2017-02-23',\n",
       " '2017-02-24',\n",
       " '2017-02-25',\n",
       " '2017-02-26',\n",
       " '2017-02-27',\n",
       " '2017-02-28',\n",
       " '2017-03-01']"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Y_output_dates"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "60"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(Y_output_dates)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "result_df = input_df[['Page'] + Y_output_dates]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>2017-01-01</th>\n",
       "      <th>2017-01-02</th>\n",
       "      <th>2017-01-03</th>\n",
       "      <th>2017-01-04</th>\n",
       "      <th>2017-01-05</th>\n",
       "      <th>2017-01-06</th>\n",
       "      <th>2017-01-07</th>\n",
       "      <th>2017-01-08</th>\n",
       "      <th>2017-01-09</th>\n",
       "      <th>...</th>\n",
       "      <th>2017-02-20</th>\n",
       "      <th>2017-02-21</th>\n",
       "      <th>2017-02-22</th>\n",
       "      <th>2017-02-23</th>\n",
       "      <th>2017-02-24</th>\n",
       "      <th>2017-02-25</th>\n",
       "      <th>2017-02-26</th>\n",
       "      <th>2017-02-27</th>\n",
       "      <th>2017-02-28</th>\n",
       "      <th>2017-03-01</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2NE1_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>26.0</td>\n",
       "      <td>42.0</td>\n",
       "      <td>35.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>51.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>...</td>\n",
       "      <td>14.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>66.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>23.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>43.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2PM_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>27.0</td>\n",
       "      <td>58.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>29.0</td>\n",
       "      <td>79.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>39.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>...</td>\n",
       "      <td>20.0</td>\n",
       "      <td>45.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>57.0</td>\n",
       "      <td>41.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>24.0</td>\n",
       "      <td>34.0</td>\n",
       "      <td>50.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3C_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>13.0</td>\n",
       "      <td>8.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>10.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>1.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>...</td>\n",
       "      <td>4.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>2.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.0</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4minute_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>12.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>9.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>18.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>5.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>...</td>\n",
       "      <td>19.0</td>\n",
       "      <td>11.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>19.0</td>\n",
       "      <td>20.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...</td>\n",
       "      <td>8.0</td>\n",
       "      <td>22.0</td>\n",
       "      <td>12.0</td>\n",
       "      <td>17.0</td>\n",
       "      <td>61.0</td>\n",
       "      <td>36.0</td>\n",
       "      <td>21.0</td>\n",
       "      <td>14.0</td>\n",
       "      <td>13.0</td>\n",
       "      <td>...</td>\n",
       "      <td>24.0</td>\n",
       "      <td>54.0</td>\n",
       "      <td>60.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>33.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>16.0</td>\n",
       "      <td>31.0</td>\n",
       "      <td>15.0</td>\n",
       "      <td>27.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 61 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Page  2017-01-01  2017-01-02  \\\n",
       "0            2NE1_zh.wikipedia.org_all-access_spider        26.0        42.0   \n",
       "1             2PM_zh.wikipedia.org_all-access_spider        27.0        58.0   \n",
       "2              3C_zh.wikipedia.org_all-access_spider        13.0         8.0   \n",
       "3         4minute_zh.wikipedia.org_all-access_spider        12.0        16.0   \n",
       "4  52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...         8.0        22.0   \n",
       "\n",
       "   2017-01-03  2017-01-04  2017-01-05  2017-01-06  2017-01-07  2017-01-08  \\\n",
       "0        35.0        13.0        51.0        11.0        12.0        31.0   \n",
       "1        47.0        10.0        29.0        79.0        21.0        39.0   \n",
       "2        12.0         3.0         5.0        10.0         4.0         1.0   \n",
       "3         9.0         9.0        16.0        18.0        15.0         5.0   \n",
       "4        12.0        17.0        61.0        36.0        21.0        14.0   \n",
       "\n",
       "   2017-01-09     ...      2017-02-20  2017-02-21  2017-02-22  2017-02-23  \\\n",
       "0        15.0     ...            14.0        11.0        66.0        18.0   \n",
       "1        16.0     ...            20.0        45.0        33.0        15.0   \n",
       "2        17.0     ...             4.0         0.0         2.0         3.0   \n",
       "3        16.0     ...            19.0        11.0        17.0        20.0   \n",
       "4        13.0     ...            24.0        54.0        60.0        31.0   \n",
       "\n",
       "   2017-02-24  2017-02-25  2017-02-26  2017-02-27  2017-02-28  2017-03-01  \n",
       "0        23.0        20.0        20.0        39.0        16.0        43.0  \n",
       "1        57.0        41.0        43.0        24.0        34.0        50.0  \n",
       "2         2.0         4.0         2.0         4.0         4.0         4.0  \n",
       "3        16.0        12.0        19.0        20.0        14.0         9.0  \n",
       "4        33.0        31.0        16.0        31.0        15.0        27.0  \n",
       "\n",
       "[5 rows x 61 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "result_flat_df = pd.melt(result_df, id_vars='Page', var_name='date',\n",
    "                         value_name='Visits')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "del input_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "596"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "gc.collect()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 8703780 entries, 0 to 8703779\n",
      "Data columns (total 3 columns):\n",
      "Page      object\n",
      "date      object\n",
      "Visits    float64\n",
      "dtypes: float64(1), object(2)\n",
      "memory usage: 199.2+ MB\n"
     ]
    }
   ],
   "source": [
    "result_flat_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>date</th>\n",
       "      <th>Visits</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2NE1_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>26.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2PM_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>27.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3C_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4minute_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Page        date  Visits\n",
       "0            2NE1_zh.wikipedia.org_all-access_spider  2017-01-01    26.0\n",
       "1             2PM_zh.wikipedia.org_all-access_spider  2017-01-01    27.0\n",
       "2              3C_zh.wikipedia.org_all-access_spider  2017-01-01    13.0\n",
       "3         4minute_zh.wikipedia.org_all-access_spider  2017-01-01    12.0\n",
       "4  52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...  2017-01-01     8.0"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "result_flat_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>2017-01-01</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>2NE1_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>26.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2PM_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>27.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3C_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>13.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4minute_zh.wikipedia.org_all-access_spider</td>\n",
       "      <td>12.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                Page  2017-01-01\n",
       "0            2NE1_zh.wikipedia.org_all-access_spider        26.0\n",
       "1             2PM_zh.wikipedia.org_all-access_spider        27.0\n",
       "2              3C_zh.wikipedia.org_all-access_spider        13.0\n",
       "3         4minute_zh.wikipedia.org_all-access_spider        12.0\n",
       "4  52_Hz_I_Love_You_zh.wikipedia.org_all-access_s...         8.0"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "input_df[['Page','2017-01-01']][0:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%%% Reading data key_1.csv ...done!\n"
     ]
    }
   ],
   "source": [
    "print('%%% Reading data key_1.csv ...', end = '', flush = True)\n",
    "output_df = pd.read_csv(\"../data/key_1.csv\")\n",
    "print('done!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>Id</th>\n",
       "      <th>date</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>bf4edcf969af</td>\n",
       "      <td>2017-01-01</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>929ed2bf52b9</td>\n",
       "      <td>2017-01-02</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>ff29d0f51d5c</td>\n",
       "      <td>2017-01-03</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>e98873359be6</td>\n",
       "      <td>2017-01-04</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>fa012434263a</td>\n",
       "      <td>2017-01-05</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Page            Id        date\n",
       "0  !vote_en.wikipedia.org_all-access_all-agents  bf4edcf969af  2017-01-01\n",
       "1  !vote_en.wikipedia.org_all-access_all-agents  929ed2bf52b9  2017-01-02\n",
       "2  !vote_en.wikipedia.org_all-access_all-agents  ff29d0f51d5c  2017-01-03\n",
       "3  !vote_en.wikipedia.org_all-access_all-agents  e98873359be6  2017-01-04\n",
       "4  !vote_en.wikipedia.org_all-access_all-agents  fa012434263a  2017-01-05"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output_df['date'] = output_df.Page.apply(lambda a: a[-10:])  # take the last 10 characters from 'Page' as date\n",
    "output_df['Page'] = output_df.Page.apply(lambda a: a[:-11])  # remove the last 10 caharacters from 'Page'\n",
    "#output_df['date'] = output_df['date'].astype('datetime64[ns]')  # convert 'date' string to numpy datetime format\n",
    "#test['weekday'] = test.date.dt.dayofweek  # find the day of week using the 'date' column\n",
    "output_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 8703780 entries, 0 to 8703779\n",
      "Data columns (total 3 columns):\n",
      "Page    object\n",
      "Id      object\n",
      "date    object\n",
      "dtypes: object(3)\n",
      "memory usage: 199.2+ MB\n"
     ]
    }
   ],
   "source": [
    "output_df.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Page</th>\n",
       "      <th>Id</th>\n",
       "      <th>date</th>\n",
       "      <th>Visits</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>bf4edcf969af</td>\n",
       "      <td>2017-01-01</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>929ed2bf52b9</td>\n",
       "      <td>2017-01-02</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>ff29d0f51d5c</td>\n",
       "      <td>2017-01-03</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>e98873359be6</td>\n",
       "      <td>2017-01-04</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>fa012434263a</td>\n",
       "      <td>2017-01-05</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>48f1e93517a2</td>\n",
       "      <td>2017-01-06</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>5def418fcb36</td>\n",
       "      <td>2017-01-07</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>77bd08134351</td>\n",
       "      <td>2017-01-08</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>5889e6dbb16f</td>\n",
       "      <td>2017-01-09</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>5f21fef1d764</td>\n",
       "      <td>2017-01-10</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>6f07e1b8815a</td>\n",
       "      <td>2017-01-11</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>228e54b5dea0</td>\n",
       "      <td>2017-01-12</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>da1b34963ed7</td>\n",
       "      <td>2017-01-13</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>ab5ccefaa2db</td>\n",
       "      <td>2017-01-14</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>cbf42873ebf1</td>\n",
       "      <td>2017-01-15</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>ac67e35ed44e</td>\n",
       "      <td>2017-01-16</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>88c098aa640d</td>\n",
       "      <td>2017-01-17</td>\n",
       "      <td>321959.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>7c72842a89d1</td>\n",
       "      <td>2017-01-18</td>\n",
       "      <td>1160760.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>8ce002f2c329</td>\n",
       "      <td>2017-01-19</td>\n",
       "      <td>1158477.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>5f72d9920560</td>\n",
       "      <td>2017-01-20</td>\n",
       "      <td>1138250.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>f93afd7f5d9b</td>\n",
       "      <td>2017-01-21</td>\n",
       "      <td>51572.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>14011cb66f2d</td>\n",
       "      <td>2017-01-22</td>\n",
       "      <td>20.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>0065551ac465</td>\n",
       "      <td>2017-01-23</td>\n",
       "      <td>15.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>175f1872729e</td>\n",
       "      <td>2017-01-24</td>\n",
       "      <td>8.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>31d756e83124</td>\n",
       "      <td>2017-01-25</td>\n",
       "      <td>10.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>e186c2363c5e</td>\n",
       "      <td>2017-01-26</td>\n",
       "      <td>9.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>3bce56c2b977</td>\n",
       "      <td>2017-01-27</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>d497981dce77</td>\n",
       "      <td>2017-01-28</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>c813cec10548</td>\n",
       "      <td>2017-01-29</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>!vote_en.wikipedia.org_all-access_all-agents</td>\n",
       "      <td>5123e0ed62c9</td>\n",
       "      <td>2017-01-30</td>\n",
       "      <td>4.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703750</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>1fb8f902ad0f</td>\n",
       "      <td>2017-01-31</td>\n",
       "      <td>376.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703751</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>0107f6d7cd82</td>\n",
       "      <td>2017-02-01</td>\n",
       "      <td>332.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703752</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>30c402ed9e49</td>\n",
       "      <td>2017-02-02</td>\n",
       "      <td>303.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703753</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>935fa0168d01</td>\n",
       "      <td>2017-02-03</td>\n",
       "      <td>321.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703754</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>1140b428380e</td>\n",
       "      <td>2017-02-04</td>\n",
       "      <td>342.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703755</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>cc5eadae0d7a</td>\n",
       "      <td>2017-02-05</td>\n",
       "      <td>349.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703756</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>f923701cdb05</td>\n",
       "      <td>2017-02-06</td>\n",
       "      <td>296.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703757</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>905679a20d39</td>\n",
       "      <td>2017-02-07</td>\n",
       "      <td>235.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703758</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>642354a50690</td>\n",
       "      <td>2017-02-08</td>\n",
       "      <td>279.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703759</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>7376c63bd4c1</td>\n",
       "      <td>2017-02-09</td>\n",
       "      <td>248.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703760</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>1f0566b71f7e</td>\n",
       "      <td>2017-02-10</td>\n",
       "      <td>209.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703761</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>938774bbb675</td>\n",
       "      <td>2017-02-11</td>\n",
       "      <td>280.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703762</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>53c046bac8cb</td>\n",
       "      <td>2017-02-12</td>\n",
       "      <td>299.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703763</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>ead2377353d3</td>\n",
       "      <td>2017-02-13</td>\n",
       "      <td>201.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703764</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>efa87c7d5160</td>\n",
       "      <td>2017-02-14</td>\n",
       "      <td>176.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703765</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>f239d6ceb17b</td>\n",
       "      <td>2017-02-15</td>\n",
       "      <td>218.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703766</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>0fef0826b1bc</td>\n",
       "      <td>2017-02-16</td>\n",
       "      <td>219.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703767</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>478d3c34b0c1</td>\n",
       "      <td>2017-02-17</td>\n",
       "      <td>221.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703768</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>6a1b6e3028fc</td>\n",
       "      <td>2017-02-18</td>\n",
       "      <td>277.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703769</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>3b5fb022accd</td>\n",
       "      <td>2017-02-19</td>\n",
       "      <td>349.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703770</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>a4456a9d271d</td>\n",
       "      <td>2017-02-20</td>\n",
       "      <td>271.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703771</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>d43a25cf4ef2</td>\n",
       "      <td>2017-02-21</td>\n",
       "      <td>252.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703772</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>8f47d2e020cd</td>\n",
       "      <td>2017-02-22</td>\n",
       "      <td>252.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703773</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>a78af728d84b</td>\n",
       "      <td>2017-02-23</td>\n",
       "      <td>210.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703774</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>d1ba45c7ec08</td>\n",
       "      <td>2017-02-24</td>\n",
       "      <td>259.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703775</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>f69747f5ee68</td>\n",
       "      <td>2017-02-25</td>\n",
       "      <td>284.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703776</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>2489963dc503</td>\n",
       "      <td>2017-02-26</td>\n",
       "      <td>301.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703777</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>b0624c909f4c</td>\n",
       "      <td>2017-02-27</td>\n",
       "      <td>307.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703778</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>24a1dfb06c10</td>\n",
       "      <td>2017-02-28</td>\n",
       "      <td>256.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8703779</th>\n",
       "      <td>龙生九子_zh.wikipedia.org_mobile-web_all-agents</td>\n",
       "      <td>add681d54216</td>\n",
       "      <td>2017-03-01</td>\n",
       "      <td>370.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>8703780 rows × 4 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "                                                 Page            Id  \\\n",
       "0        !vote_en.wikipedia.org_all-access_all-agents  bf4edcf969af   \n",
       "1        !vote_en.wikipedia.org_all-access_all-agents  929ed2bf52b9   \n",
       "2        !vote_en.wikipedia.org_all-access_all-agents  ff29d0f51d5c   \n",
       "3        !vote_en.wikipedia.org_all-access_all-agents  e98873359be6   \n",
       "4        !vote_en.wikipedia.org_all-access_all-agents  fa012434263a   \n",
       "5        !vote_en.wikipedia.org_all-access_all-agents  48f1e93517a2   \n",
       "6        !vote_en.wikipedia.org_all-access_all-agents  5def418fcb36   \n",
       "7        !vote_en.wikipedia.org_all-access_all-agents  77bd08134351   \n",
       "8        !vote_en.wikipedia.org_all-access_all-agents  5889e6dbb16f   \n",
       "9        !vote_en.wikipedia.org_all-access_all-agents  5f21fef1d764   \n",
       "10       !vote_en.wikipedia.org_all-access_all-agents  6f07e1b8815a   \n",
       "11       !vote_en.wikipedia.org_all-access_all-agents  228e54b5dea0   \n",
       "12       !vote_en.wikipedia.org_all-access_all-agents  da1b34963ed7   \n",
       "13       !vote_en.wikipedia.org_all-access_all-agents  ab5ccefaa2db   \n",
       "14       !vote_en.wikipedia.org_all-access_all-agents  cbf42873ebf1   \n",
       "15       !vote_en.wikipedia.org_all-access_all-agents  ac67e35ed44e   \n",
       "16       !vote_en.wikipedia.org_all-access_all-agents  88c098aa640d   \n",
       "17       !vote_en.wikipedia.org_all-access_all-agents  7c72842a89d1   \n",
       "18       !vote_en.wikipedia.org_all-access_all-agents  8ce002f2c329   \n",
       "19       !vote_en.wikipedia.org_all-access_all-agents  5f72d9920560   \n",
       "20       !vote_en.wikipedia.org_all-access_all-agents  f93afd7f5d9b   \n",
       "21       !vote_en.wikipedia.org_all-access_all-agents  14011cb66f2d   \n",
       "22       !vote_en.wikipedia.org_all-access_all-agents  0065551ac465   \n",
       "23       !vote_en.wikipedia.org_all-access_all-agents  175f1872729e   \n",
       "24       !vote_en.wikipedia.org_all-access_all-agents  31d756e83124   \n",
       "25       !vote_en.wikipedia.org_all-access_all-agents  e186c2363c5e   \n",
       "26       !vote_en.wikipedia.org_all-access_all-agents  3bce56c2b977   \n",
       "27       !vote_en.wikipedia.org_all-access_all-agents  d497981dce77   \n",
       "28       !vote_en.wikipedia.org_all-access_all-agents  c813cec10548   \n",
       "29       !vote_en.wikipedia.org_all-access_all-agents  5123e0ed62c9   \n",
       "...                                               ...           ...   \n",
       "8703750   龙生九子_zh.wikipedia.org_mobile-web_all-agents  1fb8f902ad0f   \n",
       "8703751   龙生九子_zh.wikipedia.org_mobile-web_all-agents  0107f6d7cd82   \n",
       "8703752   龙生九子_zh.wikipedia.org_mobile-web_all-agents  30c402ed9e49   \n",
       "8703753   龙生九子_zh.wikipedia.org_mobile-web_all-agents  935fa0168d01   \n",
       "8703754   龙生九子_zh.wikipedia.org_mobile-web_all-agents  1140b428380e   \n",
       "8703755   龙生九子_zh.wikipedia.org_mobile-web_all-agents  cc5eadae0d7a   \n",
       "8703756   龙生九子_zh.wikipedia.org_mobile-web_all-agents  f923701cdb05   \n",
       "8703757   龙生九子_zh.wikipedia.org_mobile-web_all-agents  905679a20d39   \n",
       "8703758   龙生九子_zh.wikipedia.org_mobile-web_all-agents  642354a50690   \n",
       "8703759   龙生九子_zh.wikipedia.org_mobile-web_all-agents  7376c63bd4c1   \n",
       "8703760   龙生九子_zh.wikipedia.org_mobile-web_all-agents  1f0566b71f7e   \n",
       "8703761   龙生九子_zh.wikipedia.org_mobile-web_all-agents  938774bbb675   \n",
       "8703762   龙生九子_zh.wikipedia.org_mobile-web_all-agents  53c046bac8cb   \n",
       "8703763   龙生九子_zh.wikipedia.org_mobile-web_all-agents  ead2377353d3   \n",
       "8703764   龙生九子_zh.wikipedia.org_mobile-web_all-agents  efa87c7d5160   \n",
       "8703765   龙生九子_zh.wikipedia.org_mobile-web_all-agents  f239d6ceb17b   \n",
       "8703766   龙生九子_zh.wikipedia.org_mobile-web_all-agents  0fef0826b1bc   \n",
       "8703767   龙生九子_zh.wikipedia.org_mobile-web_all-agents  478d3c34b0c1   \n",
       "8703768   龙生九子_zh.wikipedia.org_mobile-web_all-agents  6a1b6e3028fc   \n",
       "8703769   龙生九子_zh.wikipedia.org_mobile-web_all-agents  3b5fb022accd   \n",
       "8703770   龙生九子_zh.wikipedia.org_mobile-web_all-agents  a4456a9d271d   \n",
       "8703771   龙生九子_zh.wikipedia.org_mobile-web_all-agents  d43a25cf4ef2   \n",
       "8703772   龙生九子_zh.wikipedia.org_mobile-web_all-agents  8f47d2e020cd   \n",
       "8703773   龙生九子_zh.wikipedia.org_mobile-web_all-agents  a78af728d84b   \n",
       "8703774   龙生九子_zh.wikipedia.org_mobile-web_all-agents  d1ba45c7ec08   \n",
       "8703775   龙生九子_zh.wikipedia.org_mobile-web_all-agents  f69747f5ee68   \n",
       "8703776   龙生九子_zh.wikipedia.org_mobile-web_all-agents  2489963dc503   \n",
       "8703777   龙生九子_zh.wikipedia.org_mobile-web_all-agents  b0624c909f4c   \n",
       "8703778   龙生九子_zh.wikipedia.org_mobile-web_all-agents  24a1dfb06c10   \n",
       "8703779   龙生九子_zh.wikipedia.org_mobile-web_all-agents  add681d54216   \n",
       "\n",
       "               date     Visits  \n",
       "0        2017-01-01        7.0  \n",
       "1        2017-01-02        2.0  \n",
       "2        2017-01-03        4.0  \n",
       "3        2017-01-04        2.0  \n",
       "4        2017-01-05        4.0  \n",
       "5        2017-01-06        NaN  \n",
       "6        2017-01-07        5.0  \n",
       "7        2017-01-08        1.0  \n",
       "8        2017-01-09        2.0  \n",
       "9        2017-01-10        3.0  \n",
       "10       2017-01-11        5.0  \n",
       "11       2017-01-12        1.0  \n",
       "12       2017-01-13        2.0  \n",
       "13       2017-01-14        1.0  \n",
       "14       2017-01-15        3.0  \n",
       "15       2017-01-16        1.0  \n",
       "16       2017-01-17   321959.0  \n",
       "17       2017-01-18  1160760.0  \n",
       "18       2017-01-19  1158477.0  \n",
       "19       2017-01-20  1138250.0  \n",
       "20       2017-01-21    51572.0  \n",
       "21       2017-01-22       20.0  \n",
       "22       2017-01-23       15.0  \n",
       "23       2017-01-24        8.0  \n",
       "24       2017-01-25       10.0  \n",
       "25       2017-01-26        9.0  \n",
       "26       2017-01-27        7.0  \n",
       "27       2017-01-28        5.0  \n",
       "28       2017-01-29        4.0  \n",
       "29       2017-01-30        4.0  \n",
       "...             ...        ...  \n",
       "8703750  2017-01-31      376.0  \n",
       "8703751  2017-02-01      332.0  \n",
       "8703752  2017-02-02      303.0  \n",
       "8703753  2017-02-03      321.0  \n",
       "8703754  2017-02-04      342.0  \n",
       "8703755  2017-02-05      349.0  \n",
       "8703756  2017-02-06      296.0  \n",
       "8703757  2017-02-07      235.0  \n",
       "8703758  2017-02-08      279.0  \n",
       "8703759  2017-02-09      248.0  \n",
       "8703760  2017-02-10      209.0  \n",
       "8703761  2017-02-11      280.0  \n",
       "8703762  2017-02-12      299.0  \n",
       "8703763  2017-02-13      201.0  \n",
       "8703764  2017-02-14      176.0  \n",
       "8703765  2017-02-15      218.0  \n",
       "8703766  2017-02-16      219.0  \n",
       "8703767  2017-02-17      221.0  \n",
       "8703768  2017-02-18      277.0  \n",
       "8703769  2017-02-19      349.0  \n",
       "8703770  2017-02-20      271.0  \n",
       "8703771  2017-02-21      252.0  \n",
       "8703772  2017-02-22      252.0  \n",
       "8703773  2017-02-23      210.0  \n",
       "8703774  2017-02-24      259.0  \n",
       "8703775  2017-02-25      284.0  \n",
       "8703776  2017-02-26      301.0  \n",
       "8703777  2017-02-27      307.0  \n",
       "8703778  2017-02-28      256.0  \n",
       "8703779  2017-03-01      370.0  \n",
       "\n",
       "[8703780 rows x 4 columns]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "output_df = output_df.merge(result_flat_df, how='left')  # fill the 'Visits\" from result\n",
    "output_df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5         NaN\n",
       "36        NaN\n",
       "65        NaN\n",
       "96        NaN\n",
       "125       NaN\n",
       "156       NaN\n",
       "180       NaN\n",
       "181       NaN\n",
       "182       NaN\n",
       "183       NaN\n",
       "184       NaN\n",
       "185       NaN\n",
       "186       NaN\n",
       "187       NaN\n",
       "188       NaN\n",
       "189       NaN\n",
       "190       NaN\n",
       "191       NaN\n",
       "192       NaN\n",
       "193       NaN\n",
       "194       NaN\n",
       "195       NaN\n",
       "196       NaN\n",
       "198       NaN\n",
       "199       NaN\n",
       "200       NaN\n",
       "201       NaN\n",
       "202       NaN\n",
       "203       NaN\n",
       "204       NaN\n",
       "           ..\n",
       "8662659   NaN\n",
       "8662660   NaN\n",
       "8662661   NaN\n",
       "8662666   NaN\n",
       "8662668   NaN\n",
       "8662672   NaN\n",
       "8662680   NaN\n",
       "8662681   NaN\n",
       "8662684   NaN\n",
       "8662688   NaN\n",
       "8662689   NaN\n",
       "8662690   NaN\n",
       "8662692   NaN\n",
       "8662693   NaN\n",
       "8662694   NaN\n",
       "8662696   NaN\n",
       "8662699   NaN\n",
       "8662706   NaN\n",
       "8662708   NaN\n",
       "8662709   NaN\n",
       "8662711   NaN\n",
       "8662715   NaN\n",
       "8662716   NaN\n",
       "8662718   NaN\n",
       "8662719   NaN\n",
       "8662720   NaN\n",
       "8662721   NaN\n",
       "8662726   NaN\n",
       "8662728   NaN\n",
       "8662732   NaN\n",
       "Name: Visits, Length: 198221, dtype: float64"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#Check if there is null value\n",
    "output_df.loc[output_df.Visits.isnull(), 'Visits']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "model_name = 'stage_1_correct'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "%%% Writing result for stage_1_correct ...done!\n"
     ]
    }
   ],
   "source": [
    "print('%%% Writing result for ' + model_name + ' ...', \n",
    "      end = '', flush = True)\n",
    "#Write only the 'Id' and 'Visits' to the result file\n",
    "output_df[['Id','Visits']].to_csv('../results/submit_1_' + model_name\n",
    "                                  + '.csv', index = False, float_format='%d')\n",
    "print('done!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
